#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
#include<stdbool.h>
#include<assert.h>
#include<iostream>
namespace xtb
{
	class STL
	{
	public:
		//DAY1
		STL(const char* stl = "");
		size_t size()
		{
			return _size;
		}
		STL(const STL& stl)
		{
			_size = strlen(stl._stl);
			_capacity = stl._size;
			_stl = new char[_size + 1];
			strcpy(_stl, stl._stl);
			/*swap(stl);*/
			
		}
		const char* stl() const
		{
			return _stl;
		}
		char* stl()
		{
			return _stl;
		}
		typedef char* iterator;
		typedef const char* const_iterator;
		iterator begin()
		{
			return _stl;
		}
		iterator end()
		{
			return _stl + _size;
		}
		const_iterator begin()const
		{
			return _stl;
		}
		const_iterator end()const
		{
			return _stl + _size;
		}
		char& operator[](size_t pos)
		{
			return _stl[pos];
		}
		const char& operator[](size_t pos)const
		{
			return _stl[pos];
		}
		void swap(STL& s);
		~STL();
		//DAY2
		void reserve(size_t n);
		void push_back(const char ch);
		void apponed(const STL& stl);
		void apponed(const char* stl);
		STL& operator+=(const char ch);
		STL& operator+=(const char* stl);
		STL& operator+=(const STL& stl);
		void inserst(size_t pos, char ch);
		void inserst(size_t pos, const char* tmp);
		void erase(size_t pos, size_t n = npos);
		size_t find(char ch, size_t pos = 0);
		size_t find(const char* stl, size_t pos = 0);
		//DAY3
		STL& operator=(STL stl);
		STL substr(size_t pos, size_t len = npos);
	private:
		size_t _size = 0;
		size_t _capacity = 0;
		char* _stl = nullptr;
		const static size_t npos = -1;
	};
	ostream& operator<<(ostream& out, STL& s);
	istream& operator>>(istream& in, STL& s);
}